package pack0701;

import org.w3c.dom.ls.LSOutput;

import java.util.InputMismatchException;
import java.util.Scanner;

//新的需求:要求第一个数不得小于50;
public class Test3 {
    public void print(){
        try{
            Scanner scan =new Scanner(System.in) ;
            System.out.println("请输入第一个数: ");
            int a= scan.nextInt();

            if(a<50) {
                throw new MyException("数字不得小于50");
            }

            System.out.println("请输入第二个数: ");
            int b= scan.nextInt();
            System.out.println("除法的结果: "+a/b);
        }catch(InputMismatchException | MyException e){
            System.out.println("bbbbbbbbbbbbbbbbbbb");
        }
        System.out.println("计算完毕");
    }
    public void sing(){
        try{
            print();
        }catch(InputMismatchException e){
            System.out.println("抓住了输入不匹配异常");
        }
    }

    public static void main(String[] args) {
        Test3 t=new Test3();
        try{
            t.sing();
        }catch(ArithmeticException e){
            System.out.println("抓住了数学异常");
        }
        System.out.println("aaaaaaaaaaaaaaaaaaaaaa");
    }

}
